package com.ykq.controller;

import com.ykq.pojo.User;
import com.ykq.vo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

/**
 * @program: vue_axios_ssm
 * @description:
 * @author: 闫克起2
 * @create: 2023-05-18 11:16
 **/
@Controller
@RequestMapping("/user")
public class UserController {


    @RequestMapping("/getUserInfo")
    @ResponseBody
    public Result getUserInfo(HttpSession session){
        User user = (User) session.getAttribute("user");
        if(user==null){
             return new Result(500,"登录失效",null);
        }else{
            return new Result(200,"获取当前用户信息成功",user);
        }
    }
}













